﻿#include <iostream>
#include<vector>
using namespace std;

//利用第一个参数的类型去创建vector
template<class T,class ...Args>
void sum(T first,Args...args)
{
    //int p[]={(cout<<args<<endl,0)...};
    //(void)p;
    T sum=0;
    vector<T> v1={first,args...};
    for(T it:v1)
    {
        sum+=it;
        cout<<it<<endl;
    }
    cout <<"sum="<<sum<<endl;
}
int main()
{
    sum(1.99,2.99,3.99,4.99,5.9,6.87,7.78);
    return 0;
}
